<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Block_Admin_Category_Select extends Core_Block {

	protected $_cats = null;
	
	protected $_curCatId = null;
	
	public function __construct() {
		$this->_collection = App::object('Entity_Category')->getCollection();
	}
	
	protected function _beforeRender() {
		$this->setData('category_collection', $this->_collection->sortByGroup());
	}
	
	public function setExcludeCategoryId($catId) {
		$this->_collection->setExcludeCategoryId($catId);
		return $this;
	}

	public function setSelectedCategoryId($catId) {
		$this->_curCatId = $catId;
		return $this;
	}
	
	public function getSelect($id) {
		return $id == $this->_curCatId ? 'selected="selected"' : '';
	}
}